﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace TOOLS
{
   public static class Leflect
    {
        public static object RunMethod(this object entity, string MethodName, object[] pArr) 
        {
            Type t =entity.GetType();
            MethodInfo[] mi = t.GetMethods();
            foreach (MethodInfo m in mi)
            {
                if (m.Name.Equals(MethodName, StringComparison.Ordinal))
                {
                    return m.Invoke(entity, pArr);
                }
               
            }
            return null;
        }
    }
}
